﻿<UserControl
    x:Class="WinRTXamlToolkit.Sample.Views.CascadingTextBlockTestView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinRTXamlToolkit.Sample.Views"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:converters="using:WinRTXamlToolkit.Converters"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <UserControl.Resources>
        <converters:SecondsToTimeSpanStringConverter
            x:Key="SecondsToTimeSpanStringConverter" />
        <converters:NullableBoolToBoolConverter
            x:Key="NullableBoolToBoolConverter" />
        <converters:DoubleToIntConverter
            x:Key="DoubleToIntConverter" />
    </UserControl.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition
                Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <controls:CascadingTextBlock
            x:Name="cascadingTextBlock"
            Grid.Column="1"
            VerticalAlignment="Center"
            HorizontalAlignment="Center"
            Foreground="{StaticResource SliderTrackDecreaseBackgroundThemeBrush}"
            StartDelay="{Binding Value, ElementName=StartDelaySlider, Converter={StaticResource DoubleToIntConverter}}"
            CascadeIn="{Binding IsChecked, ElementName=CascadeInCheckBox, Converter={StaticResource NullableBoolToBoolConverter}}"
            CascadeInDurationString="{Binding Value, ElementName=CascadeInDurationSlider, Converter={StaticResource SecondsToTimeSpanStringConverter}}"
            HoldDurationString="{Binding Value, ElementName=HoldDurationSlider, Converter={StaticResource SecondsToTimeSpanStringConverter}}"
            CascadeOut="{Binding IsChecked, ElementName=CascadeOutCheckBox, Converter={StaticResource NullableBoolToBoolConverter}}"
            CascadeOutDurationString="{Binding Value, ElementName=CascadeOutDurationSlider, Converter={StaticResource SecondsToTimeSpanStringConverter}}"
            CascadeIntervalString="{Binding Value, ElementName=CascadeIntervalSlider, Converter={StaticResource SecondsToTimeSpanStringConverter}}"
            FromVerticalOffset="{Binding Value, ElementName=FromVerticalOffsetSlider}"
            ToVerticalOffset="{Binding Value, ElementName=ToVerticalOffsetSlider}"
            FromRotation="{Binding Value, ElementName=FromRotationSlider}"
            ToRotation="{Binding Value, ElementName=ToRotationSlider}"
            UseFade="{Binding IsChecked, ElementName=UseFadeCheckBox, Converter={StaticResource NullableBoolToBoolConverter}}"
            UseRotation="{Binding IsChecked, ElementName=UseRotationCheckBox, Converter={StaticResource NullableBoolToBoolConverter}}"
            Text="{Binding Text, ElementName=TextTextBox}"
            AnimateOnLoaded="False">
            <controls:CascadingTextBlock.TextBlockTemplate>
                <DataTemplate>
                    <TextBlock
                        Foreground="#7794B3"
                        Style="{StaticResource HeaderTextStyle}" />
                </DataTemplate>
            </controls:CascadingTextBlock.TextBlockTemplate>
        </controls:CascadingTextBlock>

        <ScrollViewer
            Width="300"
            Padding="0,0,20,0"
            Style="{StaticResource VerticalScrollViewerStyle}">
            <StackPanel>
                <TextBlock
                    Text="Text"
                    Style="{StaticResource TitleTextStyle}" />
                <TextBox
                    x:Name="TextTextBox"
                    Text="CascadingTextBlock" />

                <TextBlock
                    Text="StartDelay"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="StartDelaySlider"
                    Minimum="0"
                    Value="1"
                    SmallChange="1"
                    LargeChange="1"
                    StepFrequency="1"
                    TickFrequency="1"
                    Maximum="5" />

                <CheckBox
                    x:Name="CascadeInCheckBox"
                    IsChecked="True"
                    Content="CascadeIn" />
                <TextBlock
                    Text="CascadeInDuration"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="CascadeInDurationSlider"
                    StepFrequency="0.1"
                    SmallChange="0.1"
                    LargeChange="0.1"
                    Minimum="0"
                    Value="1"
                    Maximum="5" />

                <TextBlock
                    Text="HoldDuration"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="HoldDurationSlider"
                    StepFrequency="0.1"
                    SmallChange="0.1"
                    LargeChange="0.1"
                    Minimum="0"
                    Value="2"
                    Maximum="5" />

                <CheckBox
                    x:Name="CascadeOutCheckBox"
                    IsChecked="True"
                    Content="CascadeOut" />
                <TextBlock
                    Text="CascadeOutDuration"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="CascadeOutDurationSlider"
                    StepFrequency="0.1"
                    SmallChange="0.1"
                    LargeChange="0.1"
                    Minimum="0"
                    Value="1"
                    Maximum="5" />

                <TextBlock
                    Text="CascadeInterval"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="CascadeIntervalSlider"
                    Minimum="0.0"
                    Value="0.01"
                    StepFrequency="0.001"
                    SmallChange="0.001"
                    LargeChange="0.001"
                    Maximum="0.5" />

                <TextBlock
                    Text="FromVerticalOffset"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="FromVerticalOffsetSlider"
                    Minimum="-1000"
                    Value="-200"
                    Maximum="1000" />

                <TextBlock
                    Text="ToVerticalOffset"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="ToVerticalOffsetSlider"
                    Minimum="-1000"
                    Value="200"
                    Maximum="1000" />

                <TextBlock
                    Text="FromRotation"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="FromRotationSlider"
                    Minimum="-720"
                    Value="-120"
                    Maximum="720" />

                <TextBlock
                    Text="ToRotation"
                    Style="{StaticResource TitleTextStyle}" />
                <Slider
                    x:Name="ToRotationSlider"
                    Minimum="-720"
                    Value="90"
                    Maximum="720" />

                <CheckBox
                    x:Name="UseFadeCheckBox"
                    IsChecked="True"
                    Content="UseFade" />

                <CheckBox
                    x:Name="UseRotationCheckBox"
                    IsChecked="True"
                    Content="UseRotation" />
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
